﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PCCardN.Pages
{
    public partial class Frm_Acceptance : Form
    {
        public Frm_Acceptance()
        {
            InitializeComponent();
        }
        SqlHelper sqlHelper = new SqlHelper();
        private void dataGridViewX1_DoubleClick(object sender, EventArgs e)
        {

        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            string commondText = "Select [AppVerID] ,[CardMode] ,[CardDetail] ,[Priority] ,[State] ,[CreateDT],[ModifyDT] ,[EndDT] ,[LockDT] ,[CertificateState],[DoHis] from CardApplication_Table where AppVerID = '" + this.txtSearch.TextBox. Text + "'";
            if (this.txtSearch.TextBox.Text.Trim().Equals(""))
            {
                commondText = "Select TOP 100 [AppVerID] ,[CardMode] ,[CardDetail] ,[Priority] ,[State] ,[CreateDT],[ModifyDT] ,[EndDT] ,[LockDT] ,[CertificateState],[DoHis] from CardApplication_Table ";
            }
            DataTable dt = sqlHelper.GetQueryResult(commondText);
            this.dataGridViewX1.DataSource = dt;
        }

        private void dataGridViewX1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
        {
            string toolTip;
            if (e.ColumnIndex == 1 && e.RowIndex>=0)
            {
                toolTip = "1:人员;2 :车辆;3:物品;4:访客";

                //toolTip=GetToolTip();//这里写方法设置toolTip
                this.dataGridViewX1 .Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = toolTip;
            }
            if (e.ColumnIndex == 9 && e.RowIndex >= 0)
            {
                toolTip = "0:未知;1:通过;2:未通过";

                //toolTip=GetToolTip();//这里写方法设置toolTip
                this.dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = toolTip;
            }
            if (e.ColumnIndex == 4 && e.RowIndex >= 0)
            {
                toolTip = "0-未知,1-制证申请,2-证卡信息录入,3-证卡资料审核,4-证卡打印,5-证卡授权,6-证卡检测,7-证卡发放";
                //toolTip=GetToolTip();//这里写方法设置toolTip
                this.dataGridViewX1.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = toolTip;
            }
        }

        private void Frm_Acceptance_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.btnSearch_Click(sender, e);
            }
        }

        private void txtSearch_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.btnSearch_Click(sender, e);
            }
        }
    }
}
